package cn.pugle.base.enumeration;

/**
 * Created by tzp on 15-10-26.<br>
 */
public enum EnumTest {
    RED(255, 0, 0),
    GREEN(0, 255, 0),
    BLUE(0, 0, 255);
    private int r;
    private int g;
    private int b;

    EnumTest(int r, int g, int b) {//构造器默认且必须为private
        this.r = r;
        this.g = g;
        this.b = b;
    }

    public String getRGB() {
        return  r  + "," + g + "," + b;
    }

    public static void main(String[] args) {
        for (EnumTest name : EnumTest.values()) {
            System.out.println(name + " : " + name.ordinal());
        }
        System.out.println(EnumTest.RED.getDeclaringClass());
        System.out.println(EnumTest.valueOf("BLUE").getRGB());
        System.out.println(EnumTest.RED);
        if ("RED".equals(EnumTest.RED)){
            System.out.println("its ok");
        }
        long l = TimeUnit.SECONDS.toNanos(1);
        System.out.println(l);
    }

}
